//
//  VideoTableViewCell.m
//  LeagueOfLegend
//
//  Created by appying_wxj on 14/12/19.
//  Copyright (c) 2014年 appying_wxj. All rights reserved.
//

#import "VideoTableViewCell.h"

@implementation VideoTableViewCell

- (void)awakeFromNib {
    // Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.showImage= [[UIImageView alloc]initWithFrame:CGRectMake(10, 4, 110, 62)];
        self.showImage.backgroundColor = [UIColor clearColor];
        [self addSubview:self.showImage];
        
        //  视频的标题
        self.titleLab = [[UILabel alloc]initWithFrame:CGRectMake(125, 4, 180, 35)];
//        self.titleLab.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
        self.titleLab.font = [UIFont systemFontOfSize:14];
        self.titleLab.textAlignment = NSTextAlignmentLeft;
        self.titleLab.numberOfLines = 0;// 多行展示
        [self addSubview:self.titleLab];
        
        // 播放时间的展示
        self.timeLab = [[UILabel alloc] initWithFrame:CGRectMake(140, 50, 40, 15)];
//        self.timeLab.font = [UIFont fontWithName:@"Helvetica-Bold" size:12];
        self.timeLab.font = [UIFont systemFontOfSize:12];
        self.timeLab.textAlignment = NSTextAlignmentLeft;
        [self addSubview:self.timeLab];
        
        // 观看人数的展示
        self.peopleLab = [[UILabel alloc] initWithFrame:CGRectMake(205, 50, 50, 15)];
//        self.peopleLab.font = [UIFont fontWithName:@"Helvetica-Bold" size:12];
        self.peopleLab.font = [UIFont systemFontOfSize:12];
        self.peopleLab.textAlignment = NSTextAlignmentLeft;
        [self addSubview:self.peopleLab];
        
        // 赞
        self.zanLab = [[UILabel alloc] initWithFrame:CGRectMake(275, 50, 40, 15)];
        //        self.peopleLab.font = [UIFont fontWithName:@"Helvetica-Bold" size:12];
        self.zanLab.font = [UIFont systemFontOfSize:12];
        self.zanLab.textAlignment = NSTextAlignmentLeft;
        [self addSubview:self.zanLab];

        // 播放时间的图片
        UIImageView *timeImage  = [[UIImageView alloc] initWithFrame:CGRectMake(125, 53, 11, 11)];
        timeImage.image = [UIImage imageNamed:@"time"];
        [self addSubview:timeImage];
        
        // 播放次数
        UIImageView *numberImage  = [[UIImageView alloc] initWithFrame:CGRectMake(190, 53, 11, 11)];
        numberImage.image = [UIImage imageNamed:@"number"];
        [self addSubview:numberImage];
        
        
        // 赞的图片
        UIImageView *zanImage  = [[UIImageView alloc] initWithFrame:CGRectMake(260, 53, 11, 11)];
        zanImage.image = [UIImage imageNamed:@"zan"];
        [self addSubview:zanImage];
        
    }
    return self;
}


-(void)layoutVideoCell:(VideoDataObject *)videoObject{
    
        self.titleLab.text = [NSString stringWithFormat:@"【%@】%@",videoObject.username,videoObject.title];
    
        self.timeLab.text = videoObject.duration;
    
        self.peopleLab.text = videoObject.num;
    
        self.zanLab.text = [NSString stringWithFormat:@"%d",videoObject.zan];
        NSString *imgUrl = videoObject.img;
        [self.showImage setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:nil];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
